Skip to contentSkip to conversation

Windows,grub and grub2

DISCUSSION Viswesh S 2 participants 2 messages Sep 1, 2008

lore
Share & tools
lore

Viswesh S

author
#0 lore raw

----- Original Message ----
From: Bean <[email protected]>
To: The development of GRUB 2 <[email protected]>
Sent: Monday, 1 September, 2008 3:46:32 PM
Subject: Re: Windows,grub and grub2

Quoted 2 lines · Viswesh S

Hi,

Do you mean the result is still the same after you apply my patch ? I check the source code of grub legacy, the handling should be exactly the same. Are you using the official branch grub 0.96, or some package with modification ?

You can also check memory at 0x7be, this should be the partition table in mbr, %esi would point to the boot partition.

Signature · 29 lines
Bean

Hi,

The result is still the same after the patch.

I am using the official grub2 released package 1.96.

In that the chainloader patch wasnt there.Hence applied that according to your inputs as in the mail.

I checked the memory at 0x7be, which is the same as 0x1be in the mbr.

The first partition was already active also.

Also as I mentioned,what about the code for the int 13 extension and and their functionalities for 2,41,42.

Is there any change there.

Otherwise I am not really sure, why grub is able to boot,but grub2 not.

Viswesh
_______________________________________________
Grub-devel mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/grub-devel



      Unlimited freedom, unlimited storage. Get it now, on http://help.yahoo.com/l/in/yahoo/mail/yahoomail/tools/tools-08.html/
#1 lore raw
Quoted 36 lines · Viswesh S

----- Original Message ----
From: Bean <[email protected]>
To: The development of GRUB 2 <[email protected]>
Sent: Monday, 1 September, 2008 3:46:32 PM
Subject: Re: Windows,grub and grub2

Quoted 2 lines · Viswesh S

Hi,

Do you mean the result is still the same after you apply my patch ? I check the source code of grub legacy, the handling should be exactly the same. Are you using the official branch grub 0.96, or some package with modification ?

You can also check memory at 0x7be, this should be the partition table in mbr, %esi would point to the boot partition.

--
Bean

Hi,

The result is still the same after the patch.

I am using the official grub2 released package 1.96.

In that the chainloader patch wasnt there.Hence applied that according to your inputs as in the mail.

I checked the memory at 0x7be, which is the same as 0x1be in the mbr.

Quoted 8 lines

The first partition was already active also.

Also as I mentioned,what about the code for the int 13 extension and and their functionalities for 2,41,42.

Is there any change there.

Otherwise I am not really sure, why grub is able to boot,but grub2 not.

Hi,

I doubt that this is caused by int 13, as grub2 doesn't change it. Besides, the boot sector is read properly in grub2, so int 13 should be working.

I have thought of another possible reason for this. In grub2, %dh is 0, perhaps it should be set to the partition number. Please test if the new patch works.

Signature · 1 line
Bean
loader/i386/pc/chainloader.c +18 -3
index 825dbb3..5dcc08a 100644
@@ -101,12 +101,25 @@ grub_chainloader_cmd (const char *filename, grub_chainloader_flags_t flags)
 	  /* In i386-pc, the id is equal to the BIOS drive number.  */
 	  drive = (int) disk->id;
 
-	  if (p)
+	  if ((p) && (p->index < 4))
 	    {
-	      grub_disk_read (disk, p->offset, 446, 64,
-			      (char *) GRUB_MEMORY_MACHINE_PART_TABLE_ADDR);
+              int i;
+
+	      disk->dev->read (disk, 0, 1,
+                               (char *) GRUB_MEMORY_MACHINE_SCRATCH_ADDR);
+
+              grub_memcpy ((char *) GRUB_MEMORY_MACHINE_PART_TABLE_ADDR,
+                           (char *) GRUB_MEMORY_MACHINE_SCRATCH_ADDR + 0x1be,
+                           64);
+
 	      part_addr = (void *) (GRUB_MEMORY_MACHINE_PART_TABLE_ADDR
 				    + (p->index << 4));
+
+              for (i = 0; i < 4; i++)
+                *((char *) GRUB_MEMORY_MACHINE_PART_TABLE_ADDR + i * 16) = 0;
+
+              *((unsigned char *) part_addr) = 0x80;
+              drive |= (p->index << 8);
 	    }
 	}
 
@@ -119,6 +132,8 @@ grub_chainloader_cmd (const char *filename, grub_chainloader_flags_t flags)
   boot_drive = drive;
   boot_part_addr = part_addr;
   
+  grub_printf ("edx = %x, %esi = %p\n", drive, part_addr);
+
   grub_loader_set (grub_chainloader_boot, grub_chainloader_unload, 1);
   return;